home *** CD-ROM | disk | FTP | other *** search
- PROGRAM Thresh(input,output,picfile);
-
- { Copyright (c) 1987, Ciarcia's Circuit Cellar }
- { All Rights Reserved }
-
- {$U- control-break checking during execution }
- {$C- control-break checking during I/O operations }
- {$R- array range checking }
-
- {$Ideclares.p declarations }
- {$Ihexutil.p hex utilities }
- {$Iserial.p serial interface code }
- {$Ipictures.p picture file code }
- {$Iimages.p image processing }
-
- VAR
- level : INTEGER;
- valerror : INTEGER;
-
- BEGIN
-
- LowVideo;
-
- pic1 := NIL; { ensure new alloc }
- PicSetup(pic1); { set up picture array }
-
- filespec := GetFSpec(ParamStr(1));
-
- LoadPicture(filespec,pic1);
-
- IF Length(ParamStr(2)) = 0
- THEN BEGIN
- Write('Threshold (0-63): ');
- Readln(level);
- IF level > 63
- THEN level := 63;
- IF level < 0
- THEN level := 0;
- valerror := 0;
- END
- ELSE Val(ParamStr(2),level,valerror);
-
- IF valerror <> 0
- THEN BEGIN
- Writeln('Threshold must be numeric: ',ParamStr(2));
- Halt;
- END;
-
- Writeln('Thresholding...');
- Threshold(pic1,level);
-
- IF ParamStr(3) <> ''
- THEN filespec := ParamStr(3);
-
- SavePicture(filespec,pic1);
-
- END.